home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / Xsun / patches / sunCG3C.c.patch < prev    next >
Encoding:
Text File  |  1991-11-05  |  6.8 KB  |  268 lines

  1. *** /tmp/,RCSt1528697    Mon Nov  4 17:41:11 1991
  2. --- sunCG3C.c    Tue Jan  8 23:00:47 1991
  3. ***************
  4. *** 37,52 ****
  5.   
  6.   #include    "sun.h"
  7.   
  8.   #include    <sys/mman.h>
  9.   #include    <pixrect/memreg.h>
  10.   /*
  11.   #include    <sundev/cg4reg.h>
  12.   */
  13.   #include    "colormap.h"
  14.   #include    "colormapst.h"
  15.   #include    "resource.h"
  16. ! #include    <struct.h>
  17.   
  18.   /*-
  19.    * The cg3 frame buffer is divided into several pieces.
  20.    *    1) an array of 8-bit pixels
  21. --- 37,65 ----
  22.   
  23.   #include    "sun.h"
  24.   
  25.   #include    <sys/mman.h>
  26. + #include    <kernel/vmMach.h>
  27. + #ifndef    sprite
  28.   #include    <pixrect/memreg.h>
  29.   /*
  30.   #include    <sundev/cg4reg.h>
  31.   */
  32. + #include    <struct.h>
  33. + #endif    sprite
  34. + #include <sys/types.h>
  35.   #include    "colormap.h"
  36.   #include    "colormapst.h"
  37.   #include    "resource.h"
  38. ! #include "sys/ioctl.h"
  39. ! #include "sys/fb.h"
  40. ! #undef MAP_NEW
  41.   
  42. + struct fbtype fbType;
  43.   /*-
  44.    * The cg3 frame buffer is divided into several pieces.
  45.    *    1) an array of 8-bit pixels
  46. ***************
  47. *** 86,91 ****
  48. --- 99,105 ----
  49.   static CG3ACPtr CG3ACfb = NULL;
  50.   static CG3BCPtr CG3BCfb = NULL;
  51.   
  52.   static int  sunCG3CScreenIndex;
  53.   
  54.   /* XXX - next line means only one CG3 - fix this */
  55. ***************
  56. *** 100,106 ****
  57.       int        index, count;
  58.       u_char    *rmap, *gmap, *bmap;
  59.   {
  60. !     struct fbcmap sunCmap;
  61.   
  62.       sunCmap.index = index;
  63.       sunCmap.count = count;
  64. --- 114,120 ----
  65.       int        index, count;
  66.       u_char    *rmap, *gmap, *bmap;
  67.   {
  68. !     fbcmap sunCmap;
  69.   
  70.       sunCmap.index = index;
  71.       sunCmap.count = count;
  72. ***************
  73. *** 163,168 ****
  74. --- 177,183 ----
  75.       break;
  76.       }
  77.       (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state);
  78.       return( TRUE );
  79.   }
  80.   
  81. ***************
  82. *** 191,197 ****
  83.       pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[sunCG3CScreenIndex].ptr;
  84.       ret = (*pScreen->CloseScreen) (i, pScreen);
  85.   
  86. ! /* the following 2 lines are to fix rr clear_colormap bug */
  87.       rmap[255] = gmap[255] = bmap[255] = 0;
  88.       sunCG3CUpdateColormap(pScreen, 255, 1, rmap, gmap, bmap);
  89.   
  90. --- 206,212 ----
  91.       pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[sunCG3CScreenIndex].ptr;
  92.       ret = (*pScreen->CloseScreen) (i, pScreen);
  93.   
  94. !     /* the following 2 lines are to fix rr clear_colormap bug */
  95.       rmap[255] = gmap[255] = bmap[255] = 0;
  96.       sunCG3CUpdateColormap(pScreen, 255, 1, rmap, gmap, bmap);
  97.   
  98. ***************
  99. *** 380,387 ****
  100. --- 395,406 ----
  101.       char          **argv;       /* The arguments themselves. Don't change! */
  102.   {
  103.       if (!cfbScreenInit (pScreen,
  104. + #ifndef sprite
  105.               (sunFbs[index].info.fb_width == CG3A_WIDTH) ?
  106.               (int *) CG3ACfb->cpixel : (int *) CG3BCfb->cpixel,
  107. + #else
  108. +             sunFbs[index].fb,
  109. + #endif
  110.               sunFbs[index].info.fb_width,
  111.               sunFbs[index].info.fb_height,
  112.               monitorResolution, monitorResolution,
  113. ***************
  114. *** 460,496 ****
  115.       }
  116.   #else    _MAP_NEW
  117.       if (fbType.fb_width == CG3A_WIDTH) {
  118.       CG3ACfb = (CG3ACPtr) valloc(CG3AC_MONOLEN + 
  119.           CG3AC_ENBLEN + CG3AC_IMAGELEN);
  120.       if (CG3ACfb == (CG3ACPtr) NULL) {
  121.           ErrorF("Could not allocate room for frame buffer.\n");
  122.           return FALSE;
  123.       }
  124.   
  125.       if (mmap((caddr_t) CG3ACfb, CG3AC_MONOLEN + 
  126.           CG3AC_ENBLEN + CG3AC_IMAGELEN,
  127.           PROT_READ | PROT_WRITE,
  128.           MAP_SHARED, fd, 0) < 0) {
  129.           Error("Mapping cg3c");
  130.           (void) close(fd);
  131.           return FALSE;
  132.       }
  133.       }
  134.       else if (fbType.fb_width == CG3B_WIDTH) {
  135.       CG3BCfb = (CG3BCPtr) valloc(CG3BC_MONOLEN + 
  136.           CG3BC_ENBLEN + CG3BC_IMAGELEN);
  137.       if (CG3BCfb == (CG3BCPtr) NULL) {
  138.           ErrorF("Could not allocate room for frame buffer.\n");
  139.           return FALSE;
  140.       }
  141.       if (mmap((caddr_t) CG3BCfb, CG3BC_MONOLEN + 
  142.           CG3BC_ENBLEN + CG3BC_IMAGELEN,
  143.           PROT_READ | PROT_WRITE,
  144.           MAP_SHARED, fd, 0) < 0) {
  145.           Error("Mapping cg3c");
  146.           (void) close(fd);
  147.           return FALSE;
  148.       }
  149.       }
  150.       else {
  151. --- 479,552 ----
  152.       }
  153.   #else    _MAP_NEW
  154.       if (fbType.fb_width == CG3A_WIDTH) {
  155. + #ifdef sprite
  156. +     int    sizeToUse;
  157. +     sizeToUse = ((fbType.fb_size + VMMACH_SEG_SIZE) & ~(VMMACH_SEG_SIZE-1))
  158. +         + VMMACH_SEG_SIZE;
  159. +     CG3ACfb = (CG3ACPtr) malloc(sizeToUse);
  160. +     printf("original CG3ACfb addr: 0x%x, original size: 0x%x\n",
  161. +         CG3ACfb, sizeToUse);
  162. + #else
  163.       CG3ACfb = (CG3ACPtr) valloc(CG3AC_MONOLEN + 
  164.           CG3AC_ENBLEN + CG3AC_IMAGELEN);
  165. + #endif /* sprite */
  166.       if (CG3ACfb == (CG3ACPtr) NULL) {
  167.           ErrorF("Could not allocate room for frame buffer.\n");
  168.           return FALSE;
  169.       }
  170.   
  171. + #ifdef sprite
  172. +     CG3ACfb = (CG3ACPtr) mmap((caddr_t) CG3ACfb, fbType.fb_size,
  173. +         PROT_READ | PROT_WRITE,
  174. +         MAP_SHARED, fd, 0);
  175. +     if (CG3ACfb == (CG3ACPtr) NULL) {
  176. + #else
  177.       if (mmap((caddr_t) CG3ACfb, CG3AC_MONOLEN + 
  178.           CG3AC_ENBLEN + CG3AC_IMAGELEN,
  179.           PROT_READ | PROT_WRITE,
  180.           MAP_SHARED, fd, 0) < 0) {
  181. + #endif /* sprite */
  182.           Error("Mapping cg3c");
  183.           (void) close(fd);
  184.           return FALSE;
  185. +     } else {
  186. +         printf("new addr for CG3ACfb: 0x%x\n", CG3ACfb);
  187.       }
  188.       }
  189.       else if (fbType.fb_width == CG3B_WIDTH) {
  190. + #ifdef sprite
  191. +     int    sizeToUse;
  192. +     sizeToUse = ((fbType.fb_size + VMMACH_SEG_SIZE) & ~(VMMACH_SEG_SIZE-1))
  193. +         + VMMACH_SEG_SIZE;
  194. +     CG3BCfb = (CG3BCPtr) malloc(sizeToUse);
  195. +     printf("original CG3BCfb addr: 0x%x, original size: 0x%x\n",
  196. +         CG3BCfb, sizeToUse);
  197. + #else
  198.       CG3BCfb = (CG3BCPtr) valloc(CG3BC_MONOLEN + 
  199.           CG3BC_ENBLEN + CG3BC_IMAGELEN);
  200. + #endif /* sprite */
  201.       if (CG3BCfb == (CG3BCPtr) NULL) {
  202.           ErrorF("Could not allocate room for frame buffer.\n");
  203.           return FALSE;
  204.       }
  205. ! #ifdef sprite
  206. !     CG3BCfb = (CG3BCPtr) mmap((caddr_t) CG3BCfb, fbType.fb_size,
  207. !         PROT_READ | PROT_WRITE,
  208. !         MAP_SHARED, fd, 0);
  209. !     if (CG3BCfb == (CG3BCPtr) NULL) {
  210. ! #else
  211.       if (mmap((caddr_t) CG3BCfb, CG3BC_MONOLEN + 
  212.           CG3BC_ENBLEN + CG3BC_IMAGELEN,
  213.           PROT_READ | PROT_WRITE,
  214.           MAP_SHARED, fd, 0) < 0) {
  215. + #endif /* sprite */
  216.           Error("Mapping cg3c");
  217.           (void) close(fd);
  218.           return FALSE;
  219. +     } else {
  220. +         printf("new addr for CG3BCfb: 0x%x\n", CG3BCfb);
  221.       }
  222.       }
  223.       else {
  224. ***************
  225. *** 500,512 ****
  226.       }
  227.   #endif    _MAP_NEW
  228.   
  229. -     sunFbs[index].fd = fd;
  230.       sunFbs[index].info = fbType;
  231.   /*  sunFbs[index].EnterLeave = sunCG3CSwitch;    */
  232. !     if (fbType.fb_width == CG3A_WIDTH)
  233.       sunFbs[index].fb = (pointer) CG3ACfb;
  234. !     else
  235.       sunFbs[index].fb = (pointer) CG3BCfb;
  236.       sunSupportsDepth8 = TRUE;
  237.       return TRUE;
  238.   }
  239. --- 556,573 ----
  240.       }
  241.   #endif    _MAP_NEW
  242.   
  243.       sunFbs[index].info = fbType;
  244.   /*  sunFbs[index].EnterLeave = sunCG3CSwitch;    */
  245. ! #ifndef sprite
  246. !     sunFbs[index].fb = (pointer) fb_Addr.fb_buffer;
  247. ! #else
  248. !     if (fbType.fb_width == CG3A_WIDTH) {
  249.       sunFbs[index].fb = (pointer) CG3ACfb;
  250. !     } else if (fbType.fb_width == CG3B_WIDTH) {
  251.       sunFbs[index].fb = (pointer) CG3BCfb;
  252. +     }
  253. + #endif /*sprite*/
  254. +     sunFbs[index].fd = fd;
  255.       sunSupportsDepth8 = TRUE;
  256.       return TRUE;
  257.   }
  258.